package club.haomoon.boss.service.impl;

import club.haomoon.boss.service.ISettingProtocolService;
import club.haomoon.boss.validate.base.SettingAgreementValidate;
import club.haomoon.boss.vo.base.SettingAgreementVo;
import club.haomoon.core.util.ConfigUtil;

import org.springframework.stereotype.Service;

/**
 * 政策接口服务实现类
 */
@Service
public class SettingProtocolServiceImpl implements ISettingProtocolService {

    /**
     * 获取政策协议信息
     * @return SettingProtocolDetailVo
     */
    @Override
    public SettingAgreementVo getAgreement() {
        SettingAgreementVo vo = new SettingAgreementVo();
        vo.setServiceTitle(ConfigUtil.get("agreement", "service_title", ""));
        vo.setServiceContent(ConfigUtil.get("agreement", "service_content", ""));
        vo.setPrivacyTitle(ConfigUtil.get("agreement", "privacy_title", ""));
        vo.setPrivacyContent(ConfigUtil.get("agreement", "privacy_content", ""));
        return vo;
    }

    /**
     * 保存政策协议信息
     * @param protocolValidate 参数
     */
    @Override
    public void setAgreement(SettingAgreementValidate protocolValidate) {
        ConfigUtil.set("agreement","service_title", protocolValidate.getServiceTitle());
        ConfigUtil.set("agreement","service_content", protocolValidate.getServiceContent());
        ConfigUtil.set("agreement","privacy_title", protocolValidate.getPrivacyTitle());
        ConfigUtil.set("agreement","privacy_content", protocolValidate.getPrivacyContent());
    }

}
